<template>
    <div>
        <p id="dingdan">订单信息</p>
        <el-table :data="dingdans" height="250" style="width: 100%">
    <el-table-column prop="plan.time" label="开场时间" width="180" />
    <el-table-column prop="plan.film.fname" label="片名" width="180" />
    <el-table-column prop="plan.cinema.cname" label="影院" />
    <el-table-column prop="plan.room.rname" label="放映厅" />
    <el-table-column prop="seat.no" label="选座购票" />
    <el-table-column prop="plan.price" label="售价(元)" />
    <!-- <el-table-column prop="address" label="选座购票" /> -->
    <el-table-column label="操作" width="120">
      <template #default="scope">
        <el-button link type="primary" size="small" @click="delect(scope.row.sid,scope.row.seat.no,scope.row.pid)"
          >取消购票</el-button
        >
      </template>
    </el-table-column>
  </el-table>
    </div>
    
  </template>
  <script>
    import axios from 'axios'
    export default {
      name: 'gdingdan',
      data(){
        return{
            dingdans:[],
    
        }
    
      },
      components: {
      },
      watch:{
        'dingdans'(){
          var user=JSON.parse(sessionStorage.getItem('myuser'));
        console.log(344,user);
     axios.get("http://localhost:8080/listbyuid/"+user.id).then((resp) => {
      this.dingdans = resp.data;
      console.log(this.dingdans);
    });

        }

      },
      methods:{
        delect(sid,no,pid){
            axios.get("http://localhost:8080/delectlistbysid/"+sid).then((resp) => {
      var n = resp.data;
      axios.get("http://localhost:8080/updateseat0/"+no+"/"+pid).then((resp) => {
            var n=resp.data;
    })
    var user=JSON.parse(sessionStorage.getItem('myuser'));
        console.log(344,user);
      axios.get("http://localhost:8080/listbyuid/"+user.id).then((resp) => {
      this.dingdans = resp.data;
      console.log(this.dingdans);
    });
    });
        }},
      created() {
        var user=JSON.parse(sessionStorage.getItem('myuser'));
        console.log(344,user);
     axios.get("http://localhost:8080/listbyuid/"+user.id).then((resp) => {
      this.dingdans = resp.data;
      console.log(this.dingdans);
    });
  }
    }
    </script>
  <style scoped>
    *{
        padding:0px;
        margin:0px;
    }
    #dingdan{
    box-sizing: border-box;
    color:orange;
    padding-left:400px;
    border-bottom:solid 2px orange;
    height: 60px;
    padding-top:15px ;
    font-size: 25px;
    }
  
  </style>
  